<template>
    <div>
        <h4>demo3</h4>
        <!-- <p>主文件的：{{ a }}</p> -->
        <p>模块的：{{ student.a }}</p>
        <!-- <button @click="setA">改变</button> -->
        <p>{{ b }}</p>
        <button @click="setA">改变模块A</button>
    </div>
</template>
<script>
import { mapState, mapMutations ,mapGetters} from 'vuex'
export default {
    data() {
        return {
        }
    },
    computed: {
        // a:function(){
        //     return this.$store.state.student.a
        // }
        ...mapState(['student']),
        ...mapGetters('student',['b'])
        //...mapState(['a'])
        // b: function () {
        //     console.log(this.$store)
        //     return this.$store.getters['student/b']
        // }
    },
    methods: {
        // setA(){
        //     this.$store.commit('setA')
        // }
        //...mapMutations(['setA'])
        ...mapMutations('student', ['setA'])
        // setAA(){
        //     console.log(this.$store)
        //     this.$store.commit('student/setA');
        // }
    },
    created() {
        //console.log(this.$store)
    }

}
</script>